package cn.amoqi.springboot.mybatisplus.util;

import com.alibaba.fastjson.JSON;

import java.util.List;

public class BeanUtils<T> {
    public static <T> T copy(Object obj,Class<T> clazz){
        String jsonString = JSON.toJSONString(obj);
        T target = JSON.parseObject(jsonString,clazz);
        return target;
    }
    public static <T>List<T> copyArray(Object obj,Class<T> clazz){
        String jsonString = JSON.toJSONString(obj);
        List<T> target = JSON.parseArray(jsonString,clazz);
        return target;
    }
}
